home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / wil4c10.zip / WIL4C_U.TXT < prev   
Text File  |  1997-07-26  |  84KB  |  2,523 lines

  1.  
  2.  
  3.  
  4.  
  5.                        Winsock Interface Library
  6.  
  7.                                for C/C++
  8.  
  9.                                  (WIL4C)
  10.  
  11.  
  12.                              USERS MANUAL
  13.  
  14.  
  15.  
  16.                                Version 1.0
  17.  
  18.                                July 28, 1997
  19.  
  20.  
  21.  
  22.  
  23.                      This software is provided as-is.
  24.               There are no warranties, expressed or implied.
  25.  
  26.  
  27.  
  28.  
  29.                          Copyright (C) 1997
  30.                            All rights reserved
  31.  
  32.  
  33.  
  34.                        MarshallSoft Computing, Inc.
  35.                            Post Office Box 4543
  36.                            Huntsville AL 35815
  37.  
  38.                            Voice : 205-881-4630
  39.                              FAX : 205|880|0925
  40.                              BBS : 205-880-9748
  41.                            email : info@marshallsoft.com
  42.                              web : www.marshallsoft.com
  43.  
  44.                                _______
  45.                           ____|__     |                (R)
  46.                        --+       |    +-------------------
  47.                          |   ____|__  |  Association of
  48.                          |  |       |_|  Shareware
  49.                          |__|   o   |    Professionals
  50.                        --+--+   |   +---------------------
  51.                             |___|___|    MEMBER
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.      WIL4C Users Manual                                        Page 1
  61.  
  62.                             C O N T E N T S
  63.  
  64.  
  65.  
  66.         Chapter                                     Page
  67.  
  68.  
  69.        1.0 Introduction................................................3
  70.            1.1 User Support............................................4
  71.            1.2 ASP Ombudsman...........................................4
  72.            1.3 Installation............................................5
  73.            1.4 Consulting Services.....................................5
  74.        2.0 Library Organization........................................6
  75.            2.1 Dynamic Link Libraries..................................6
  76.            2.2 Using the Library.......................................6
  77.            2.3 Compiling Programs......................................6
  78.            2.4 Using a MAKEFILE........................................6
  79.            2.5 Using an IDE............................................7
  80.            2.6 Compiling WIL4C.........................................9
  81.            2.7 Compiling Example Programs..............................9
  82.        3.0 Internet Programming.......................................10
  83.            3.1 Internet RFCs..........................................10
  84.            3.2 Protocol Layers........................................11
  85.            3.3 The Internet Protocol (IP).............................11
  86.            3.4 Socket Concepts........................................12
  87.            3.5 Client and Server Programming..........................14
  88.            3.6 Stream (TCP) Programming...............................14
  89.            3.7 Windows Winsock Programming............................14
  90.            3.8 Synchronous VS Asynchronous Programming................15
  91.            3.9 The ASYNC Functions....................................16
  92.        4.0 Internet Protocols.........................................20
  93.            4.1 Finger Protocol........................................20
  94.            4.2 SMTP Protocol..........................................21
  95.            4.3 POP3 Protocol..........................................23
  96.            4.4 NNTP Protocol..........................................25
  97.            4.5 FTP Protocol...........................................28
  98.            4.6 HTTP Protocol..........................................31
  99.        5.0 Problems...................................................33
  100.        6.0 Example Programs...........................................34
  101.            6.1 HOST...................................................34
  102.            6.2 SFINGR, AFINGER, and FINGER............................34
  103.            6.3 FROM...................................................34
  104.            6.4 MAIL...................................................35
  105.            6.5 FTP....................................................35
  106.            6.6 NEWS...................................................36
  107.            6.7 VIEW...................................................36
  108.            6.8 WHO_C and WHO_S........................................37
  109.            6.9 BCAST..................................................37
  110.        7.0 Legal Issues...............................................38
  111.            7.1 Registration...........................................38
  112.            7.2 License................................................39
  113.            7.3 Warranty...............................................39
  114.        8.0 Summary....................................................40
  115.            8.1 Revision History.......................................40
  116.            8.2 WIL Function Summary...................................40
  117.        9.0 Other MarshallSoft Computing Products......................42
  118.  
  119.  
  120.      WIL4C Users Manual                                        Page 2
  121.  
  122.       1.0 Introduction
  123.  
  124.       The Winsock Interface Library for C/C++ (WIL4C) is a function library
  125.       that simplifies Winsock programming and provides support for the most
  126.       common Internet protocols such as DNS (Domain Name System), Finger,
  127.       SMTP (Simple Mail Transport Protocol), POP3 (Post Office Protocol
  128.       Version 3), FTP (File Transfer Protocol), NNTP (Network News
  129.       Transport Protocol), and HTTP (Hypertext Transfer Protocol).
  130.  
  131.       Winsock network programming is not easy. Because of this, the primary
  132.       purpose in designing WIL was to simplify Winsock programming.
  133.  
  134.       Winsock simplification is accomplished by:
  135.  
  136.       (1) Handling details like converting from host byte order to network
  137.       byte order (and vice versa) as necessary automatically.
  138.  
  139.       (2) Handling the creation and manipulation of winsock data
  140.       structures automatically.
  141.  
  142.       (3) Proving a straight forward interface, using only necessary
  143.       arguments.
  144.  
  145.       (4) Providing more powerful functions, which may perform multiple
  146.       Winsock functions.
  147.  
  148.       The WIL can be called from any program capable of calling Windows API
  149.       functions, such as Delphi and Visual Basic.
  150.  
  151.       Support for the most common Internet protocols is provided by the
  152.       ASYNC.C functions, which can transmit commands and receive responses
  153.       formatted as used by these protocols.
  154.  
  155.       Lastly, a good selection of example programs are provided, covering
  156.       the major Internet protocols. The example programs are designed to
  157.       demonstrate how to use the WIL library functions. One of the best
  158.       ways to learn Winsock programming is to study these examples.
  159.  
  160.       The shareware and registered versions are identical except for two
  161.       differences: (1) the shareware version displays the "shareware"
  162.       screen, and (2) the shareware version will "time out" after 20
  163.       minutes, limiting execution to a maximum of twenty minutes EACH time
  164.       a program is run. Of course, the registered version does not display
  165.       the shareware screen nor time out after twenty minutes.
  166.  
  167.       We apologize for the inconvenience of the twenty minute timeout.
  168.       Please contact us if more time is needed in order to evaluate WIL4C.
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.      WIL4C Users Manual                                        Page 3
  181.  
  182.       1.1 User Support
  183.  
  184.       We want you to be successful in developing your applications using
  185.       WIL4C! We depend upon our customers to let us know what they need in
  186.       a winsock communications library.  This means we are committed to
  187.       providing the best library that we can. If you have any suggestions
  188.       or comments, please let us know.
  189.  
  190.       If you are having a problem using WIL4C, call us at 205-881-4630
  191.       between 1:30 PM and 9:30 PM CST Monday through Friday. You can also
  192.       call at other times and leave a message, and call back later for a
  193.       reply.
  194.  
  195.       However, we can only answer questions with respect to using the WIL4C
  196.       library or our example programs.  We cannot help you program your
  197.       application. See section 1.4 "Consulting Services".
  198.  
  199.       If you are on the Internet, email us at info@marshallsoft.com.  You
  200.       can also get the latest versions of our products from our anonymous
  201.       ftp site:
  202.  
  203.             FTP: ftp.marshallsoft.com      PATH: marshallsoft
  204.  
  205.       The MarshallSoft Computing, Inc. newsletter "Comm Talk" is published
  206.       quarterly.  It discusses various communications problems and
  207.       solutions using WIL4C as well as related information.
  208.  
  209.       The latest copy of our newsletter can be found on our anonymous ftp
  210.       site (directory /marshallsoft/other) as well as our web site.
  211.  
  212.           Web site:  www.marshallsoft.com
  213.  
  214.       Our FTP site can also be accessed from our Web site.
  215.  
  216.       1.2 ASP Ombudsman
  217.  
  218.       MarshallSoft Computing, Inc.  is a member of the Association of
  219.       Shareware Professionals (ASP).  ASP wants to make sure that the
  220.       shareware principle works for you.  If you are unable to resolve a
  221.       shareware-related problem with an ASP member by contacting the member
  222.       directly, ASP may be able to help.  The ASP Ombudsman can help you
  223.       resolve a dispute or problem with an ASP member, but does not provide
  224.       technical support for members' products. Please write to the ASP
  225.       Ombudsman at 545 Grover Road, Muskegon, MI USA 49442-9427, Fax
  226.       616-788-2765, or send a CompuServe message via CompuServe Mail to ASP
  227.       Ombudsman 70007,3536.
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.      WIL4C Users Manual                                        Page 4
  241.  
  242.       1.3 Installation
  243.  
  244.       (1) Before installation of WIL4C, your Windows C/C++ compiler should
  245.       already be installed on your system and tested. In particular,
  246.       include command line tools when installing your compiler.
  247.  
  248.       (2) Make a backup copy of your distribution disk.  Put your original
  249.       distribution disk in a safe place.
  250.  
  251.       (3) Exit Windows into DOS, or start a DOS window:
  252.  
  253.       (4) Create your WIL project directory, copy the WIL archive, then
  254.       unzip the archive. For example:
  255.  
  256.                 MKDIR   WIL
  257.                 PKUNZIP WIL4C10.ZIP WIL
  258.  
  259.       (5) Use the provided install batch file (INSTALL) to install the
  260.       library. The format is:
  261.  
  262.                 INSTALL <compiler>
  263.  
  264.       where <compiler> must be "MS" for Microsoft,  "BC"  for  Borland,  or
  265.       "WC" for Watcom. INSTALL performs the following copy operations:
  266.  
  267.       Microsoft:
  268.  
  269.          COPY WIL32M.LIB WIL32.LIB
  270.          COPY WIL32M.DLL WIL32.DLL
  271.  
  272.       Borland:
  273.  
  274.          COPY WIL32B.LIB WIL32.LIB
  275.          COPY WIL32B.DLL WIL32.DLL
  276.  
  277.       Watcom:
  278.  
  279.          COPY WIL32W.LIB WIL32.LIB
  280.          COPY WIL32W.DLL WIL32.DLL
  281.  
  282.       WIL16.DLL is common for all of the supported compilers.
  283.  
  284.       1.4 Consulting Services
  285.  
  286.       We offer consulting services at $75 per hour, billed to your credit
  287.       card in 10 minute increments. A work authorization letter must be
  288.       signed and mailed or FAXed to us before we can start.
  289.  
  290.       Questions dealing with the use of our library or our example programs
  291.       are covered as "support", for which there is no charge. Any other
  292.       questions are considered consulting.
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.      WIL4C Users Manual                                        Page 5
  301.  
  302.       2.0 Library Overview
  303.  
  304.       2.1 Dynamic Link Libraries
  305.  
  306.       WIL4C includes both Win16 [WIL16] and a Win32 [WIL32] dynamic link
  307.       library (DLL). A DLL is characterized by the fact that it need not be
  308.       loaded until required by an application program and that only one
  309.       copy of the DLL is necessary regardless of the number of application
  310.       programs that use it. Contrast this to the traditional static library
  311.       which is bound to each and every application that uses it at link
  312.       time.
  313.  
  314.       Since WIL4C is a DLL, only one copy of the WIL4C code and data is
  315.       loaded into memory regardless of the number of applications programs
  316.       that use it. For example, more than one instance of the test program
  317.       FINGER can be started.  All copies of FINGER can run concurrently.
  318.  
  319.       2.2 Using the Library
  320.  
  321.       The WIL4C has been tested on a Gateway 2000 (25 MHz 80386-DX, Windows
  322.       3.1), a Gateway 2000 (66 MHz 80486-DX2, Windows 3.1), a Mid-West
  323.       Micro (150 MHz Pentium, Windows 95), and a Toshiba Satellite (100 MHz
  324.       Pentium, Windows 95).
  325.  
  326.       WIL4C has also been tested with Microsoft Visual C/C++, Borland C/C++
  327.       (including C Builder), Turbo C/C++, and Watcom C/C++.
  328.  
  329.       2.3 Compiling Programs
  330.  
  331.       The example programs can be compiled by using either the provided
  332.       makefiles or creating a project file for the IDE. Separate makefiles
  333.       are provide for Win16 and Win32. 16-bit makefile end with "16" while
  334.       32-bit makefiles end with "32".
  335.  
  336.       2.4 Using a MAKEFILE
  337.  
  338.       Makefiles originated on UNIX systems. They are the standard way that
  339.       C/C++ programs are constructed in command line environments. Windows
  340.       programs can be constructed with makefiles running DOS using command
  341.       line Windows compilers.
  342.  
  343.       Makefiles are provided for Microsoft, Borland, and WATCOM command
  344.       line compilers. Makefiles have file extensions of "_M_" for
  345.       Microsoft, "_B_" for Borland, and "_W_" for WATCOM. Thus,
  346.       FINGER16._W_ is the Watcom Win16 makefile for FINGER and FINGER32._M_
  347.       is the Microsoft Win32 makefile.
  348.  
  349.       Turbo C/C++ for Windows and Borland C Builder do not support command
  350.       line makefiles.
  351.  
  352.       Refer to MAKEFILE.TXT for more information on makefiles.
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.      WIL4C Users Manual                                        Page 6
  361.  
  362.       2.5 Using an IDE
  363.  
  364.       All current windows compilers have an Integrated Development
  365.       Environment (IDE) for building application programs in the Windows
  366.       environment. Since there is no standard format for IDE project files,
  367.       file names must be entered into the IDE from the keyboard.  Each
  368.       example program has a project text file (e.g. FINGER.PRJ) which
  369.       contains the list of filenames that must be entered into the IDE.
  370.  
  371.       We do not distribute IDE files in our package because (1) they are
  372.       very large, (2) they are not always upwardly compatible with previous
  373.       versions of a particular IDE, (3) there is no standard project file
  374.       format between compiler manufactures, and (4) they often must be
  375.       modified to provide the correct path names.
  376.  
  377.       However, creating a project file within the IDE is very easy. Each
  378.       application has a project file . Each project file contains the
  379.       filenames that must be entered into the IDE.
  380.  
  381.       For each IDE, you will have to enter these filenames into the IDE.
  382.       This is usually done with the INS key except for the Microsoft
  383.       Developer, which uses menu commands. Be careful to enter all
  384.       filenames as listed in the ".PRJ" file.
  385.  
  386.       All of the example application programs have been built using IDEs
  387.       from Microsoft, Borland, and Watcom. However, there are differences
  388.       between IDE versions from the same compiler manufacturer.
  389.  
  390.       All of the IDEs use the concept of a file hierarchy. For example, the
  391.       Finger file hierarchy in the IDE (for 32-bit) should look like:
  392.  
  393.          FINGER.EXE
  394.          |-- ABOUT.C
  395.          |-- ASYNC.C
  396.          |-- FINGER.C
  397.          |-- FINGER.DEF
  398.          |-- FINGER.RC
  399.          |-- PAINT.C
  400.          |-- STR.C
  401.          |-- WIL32.LIB
  402.  
  403.       Replace WIL32.LIB above with WIL16.LIB for 16-bit applications. The
  404.       order of the files is not significant.
  405.  
  406.       2.5.1 Microsoft IDE
  407.  
  408.       Choose "Project", then "New". Select Win16 [Win32] as the target. A
  409.       dialog box will then pop up into which the project file names are
  410.       entered.
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.      WIL4C Users Manual                                        Page 7
  421.  
  422.       2.5.2 Microsoft Developer
  423.  
  424.       Choose "File", then "New", then "Project Workspace". Select
  425.       "Application" for "Type:" and your project name for "Name:". Choose
  426.       Win16 or Win32 for platform. Then select "Create".
  427.  
  428.       Select "Insert", then "Files into Project". Add all filenames as
  429.       listed in the ".PRJ" file corresponding to the project you are
  430.       building. Lastly, select "Rebuild All".
  431.  
  432.       2.5.3 Borland IDE
  433.  
  434.       Turn off LINKER case sensitivities: Choose "Options", "Projects",
  435.       "Linker", "General". Turn off the "case sensitive link" and "case
  436.       sensitive exports and imports" boxes.
  437.  
  438.       Next, choose "Project", then "New Project". Use the INS (Insert) key
  439.       to pop up a dialog box into which the project file names are entered.
  440.  
  441.       Select "GUI" for the "Target Model:" Only "Runtime" and "Dynamic"
  442.       should be checked for "Standard Libraries:"
  443.  
  444.       NOTE1: If, after linking in the IDE, you get unresolved external
  445.       references to the communications library functions in which each
  446.       function name is all upper case, then you have NOT turned off case
  447.       sensitivity as described above.
  448.  
  449.       NOTE2: If you get errors compiling the windows header file
  450.       "WINDOWS.H", turn on "Borland Extensions" in "Options", "Project",
  451.       "Compiler", "Source".
  452.  
  453.       2.5.4 Turbo C IDE
  454.  
  455.       Follow the same directions as above, except that the "Target Model:"
  456.       can be any listed.
  457.  
  458.       2.5.5 Borland C Builder
  459.  
  460.       Choose "File" / "Open Project" on the menu bar. Load BCB_PRJ.MAK.
  461.       Then, choose "Build All" from "Project" to create the executable.
  462.  
  463.       2.5.6 Watcom IDE
  464.  
  465.       Choose "File", then "New Project". Enter the project name and then
  466.       choose Win16 [Win32] as the target. Use the INS (Insert) key to pop
  467.       up a dialog box into which the project file names are entered.
  468.  
  469.       Select "Options" from the main window, then "C Compiler Switches",
  470.       then "10". Memory Models and Processor Switches". Check "80386 Stack
  471.       based calling [-3s]", then check "32-bit Flat model [-mf]".
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.      WIL4C Users Manual                                        Page 8
  481.  
  482.       2.6 Compiling WIL4C
  483.  
  484.       Precompiled DLL's are provided on disk for all the supported
  485.       compilers. Registered users can recompile WIL.C in order to create
  486.       WIL16.DLL and WIL32.DLL. Makefiles are provided for each compiler.
  487.  
  488.       For Microsoft C, type:
  489.  
  490.           NMAKE -f WIL16._M_
  491.           NMAKE -f WIL32._M_
  492.  
  493.       For Borland C, type:
  494.  
  495.           MAKE -f WIL16._B_
  496.           MAKE -f WIL32._B_
  497.  
  498.       For Watcom C, type:
  499.  
  500.           WMAKE -f WIL16._W_
  501.           WMAKE -f WIL32._W_
  502.  
  503.       2.7 Compiling Example Programs
  504.  
  505.       There are makefiles provided for each of the example programs.
  506.       For example, to compile FINGER:
  507.  
  508.       For Microsoft C, type:
  509.  
  510.           NMAKE -f FINGER16._M_
  511.           NMAKE -f FINGER32._M_
  512.  
  513.       For Borland C, type:
  514.  
  515.           MAKE -f FINGER16._B_
  516.           MAKE -f FINGER32._B_
  517.  
  518.       For Watcom C, type:
  519.  
  520.           WMAKE -f FINGER16._W_
  521.           WMAKE -f FINGER32._W_
  522.  
  523.       WIL.C can also be recompiled within the IDE.
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.      WIL4C Users Manual                                        Page 9
  541.  
  542.       3.0 Internet Network Programming
  543.  
  544.       It is assumed that the user of the WIL library is familiar with the
  545.       Internet and programming, but not necessarily network programming.
  546.  
  547.       For more detailed information on the structure of the Internet, refer
  548.       to one of the many excellent books on the subject. One of the best is
  549.       Internetworking with TCP/IP, Volume I by Douglas E. Comer (Prentice
  550.       Hall, ISBN 0-13-216987-8).
  551.  
  552.       One of the best ways to learn network programming is to study (and
  553.       eventually modify) example code. For this reason, a good selection of
  554.       program examples are provided.
  555.  
  556.       3.1 Internet RFCs
  557.  
  558.       The various Internet standards are defined in "Requests for
  559.       Comments", or RFCs. RFCs are text files, and are available on the
  560.       Internet at ftp://ds.internic.net. The index of all RFC documents is
  561.       found in file rfc-index.txt.
  562.  
  563.       Some important RFCs include:
  564.  
  565.       RFC  791 : The Internet Protocol (IP)
  566.       RFC  821 : Simple Mail Transport Protocol (SMTP).
  567.       RFC  822 : SMTP Message Format.
  568.       RFC  959 : File Transfer Protocol (FTP).
  569.       RFC 1036 : Network News Transport Protocol (NNTP).
  570.       RFC 1288 : The Finger protocol.
  571.       RFC 1460 : Post Office Protocol, Version 3 (POP3).
  572.       RFC 1521 : Multipurpose Extensions Mail Extensions (MIME).
  573.       RFC 2068 : Hypertext Transfer Protocol 1.1 (HTTP).
  574.  
  575.       The above is just a sampling of the thousands of RFCs. Anyone wanting
  576.       to implement a particular protocol should download a copy of the
  577.       appropriate RFCs from the Internic.
  578.  
  579.       In addition to RFCs, the Internic also publishes additional classes
  580.       of documents:
  581.  
  582.          (1) Internet Drafts (ID).
  583.          (2) For Your Information (FYI).
  584.          (3) Standard RFCs (STD).
  585.  
  586.       These documents are also found at ftp://ds.internic.net.
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.      WIL4C Users Manual                                        Page 10
  601.  
  602.       3.2 Protocol Layers
  603.  
  604.       The internet protocol layers look like:
  605.  
  606.          +---------------------+
  607.          | Application Program |         FINGER.C, MAIL.C, FTP.C, ...
  608.          +-+-----+-------------+
  609.            |     |
  610.            |   +-+-----------+
  611.            |   | WIL Library |           WIL16.DLL and WIL32.DLL
  612.            |   +-+-----------+
  613.            |     |
  614.          +-+-----+-----+
  615.          | WINSOCK DLL |                 WINSOCK.DLL and WSOCK32.DLL
  616.          +-------+-----+
  617.                  |
  618.                  +---------+
  619.                  |         |
  620.          +-------+--+  +---+------+
  621.          | TCP code |  | UDP code |      (vendor specific)
  622.          +--------+-+  ++---------+
  623.                   |     |
  624.                 +-+-----+-+
  625.                 | IP code |
  626.                 +----+----+
  627.                      |
  628.              +-------+--------+
  629.              | Network Driver |
  630.              +-------+--------+
  631.                      |
  632.              +-------+--------+
  633.              |   LAN or PPP   |
  634.              +----------------+
  635.  
  636.       Each of the example programs uses the WIL (Winsock Interface Library)
  637.       to simplify access to the WINSOCK.
  638.  
  639.       3.3 The Internet Protocol (IP)
  640.  
  641.       The Internet Protocol (IP) is the basis upon everthing else is built.
  642.       It is documented in RFC 791.
  643.  
  644.       3.3.1 Best Effort Delivery
  645.  
  646.       Internet Protocol (IP) provides a "best effort" in delivering IP
  647.       packets. Packets may arrive out of order, or may not arrive at all.
  648.       The TCP (Transport Control Protocol) and UDP (User Datagram Protocol)
  649.       are built on top of IP and perform additional error detection and
  650.       correction.
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.      WIL4C Users Manual                                        Page 11
  661.  
  662.       3.3.2 IP Addresses
  663.  
  664.       Each host computer is assigned an unique 32-bit internet address that
  665.       is used for all internet communications. Thus, if you dial up your
  666.       Internet Service Provider (ISP), you are assigned an IP address owned
  667.       by the ISP which is used to uniquely identify you while you are
  668.       connected.
  669.  
  670.       The IP address is often written as four 8-bit decimal octets (bytes)
  671.       separated by decimal points. For example, the 32-bit hexidecimal
  672.       number 12AF7B02 can be written as
  673.  
  674.          18.175.123.2
  675.  
  676.       The internet standard for byte ordering within an integer is "Big
  677.       Endian" (most significant byte first) and is denoted as the "network
  678.       byte order". The host byte order depends on the particular computer
  679.       architecture. For Intel based PCs, the host byte ordering is "Little
  680.       Endian" (least significant byte first).
  681.  
  682.       The WINSOCK provides functions to convert between them. The Winsock
  683.       Inteface Library (WIL) library always deals with addresses in host
  684.       order, converting as necessary when communicating with the WINSOCK.
  685.  
  686.       3.4 Socket Concepts
  687.  
  688.       A socket is a small integer number used to identify the endpoint for
  689.       TCP/IP communications. It is the fundamental Internet network
  690.       programming interface.
  691.  
  692.       3.4.1 Socket Ports
  693.  
  694.       Internet communications occurs between two end-points each of which
  695.       is defined by an IP address and a "port number", a 16-bit integer
  696.       number. In this way, multiple sessions between the same two computers
  697.       can occur simultaneously, each using a different port number.
  698.  
  699.       Established Internet Protocols have a port number called the "well
  700.       known port" assigned to them. For example, FTP always uses port
  701.       number 21.
  702.  
  703.       Application server programs should use a port number of at least
  704.       5000. See the WHO_S program for an example server.
  705.  
  706.       Sockets are further differentiated as to whether they are TCP sockets
  707.       or UDP sockets. WIL supports TCP sockets only.
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.      WIL4C Users Manual                                        Page 12
  721.  
  722.       3.4.2 Socket Address Structure
  723.  
  724.       The socket requires a socket address structure which contains
  725.       additional information neccessary (port number, remote IP address,
  726.       etc.) for communications to a remote endpoint.
  727.  
  728.       The WIL library handles all details of socket address structures.
  729.  
  730.       3.4.3 TCP and UDP Sockets
  731.  
  732.       There are two types of sockets: datagrams (UDP sockets) and streams
  733.       (TCP sockets).
  734.  
  735.       UDP sockets are rarely used in network application programming, and
  736.       are thus not implemented in WIL.
  737.  
  738.       TCP sockets implement bi-directional data streams, guaranteed to be
  739.       error free. TCP is used for most application level net programming,
  740.       including all of the example programs.
  741.  
  742.       3.5 Client and Server Side
  743.  
  744.       There are two distinct classes of internet programming: Client side
  745.       and Server side.
  746.  
  747.       3.5.1 Server Programs
  748.  
  749.       A server is a program that provides some service. It runs
  750.       continuously, waiting for a client to connect to it. Server programs
  751.       listen for incoming connections. When an incoming connection is
  752.       detected, the server program can accept the connection, after which
  753.       the socket I/O can occur.
  754.  
  755.  
  756.           +------+
  757.           | BIND |
  758.           +--+---+
  759.              |
  760.          +---+----+            +--------+
  761.          | LISTEN +------------+ ACCEPT |
  762.          +--------+            +--------+
  763.  
  764.  
  765.       The program WHO_S is an example of a simple server program. It
  766.       provides a simple "whois" service for its client WHO_C. Also see
  767.       WHO_C, which is an example of a client for the WHO_S server.
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.      WIL4C Users Manual                                        Page 13
  781.  
  782.       3.5.2 Client Programs
  783.  
  784.       Most user application progams are "client side" programs. A client
  785.       program is a program that connects to a server program to perform
  786.       some service. A client program is run only when the service is
  787.       needed.
  788.  
  789.       FINGER, VIEW, MAIL, FROM, FTP, NEWS, and WHO_C are all examples of
  790.       client programs.
  791.  
  792.       3.6 Stream (TCP) Programming
  793.  
  794.       TCP (Transmission Control Protocol) is the basic protocol upon which
  795.       all of the example programs are written. Some important
  796.       characteristics of a TCP connection are:
  797.  
  798.       (1) The TCP connection as a bi-direction pipe, or stream. There is no
  799.       concept of packets at the TCP level. What goes in one end comes out
  800.       the other.
  801.  
  802.       (2) TCP provides for a reliable connection. Addition checksums are
  803.       not required.
  804.  
  805.       (3) TCP uses a 16-bit port number to identify the connection
  806.       endpoint. Thus, an "endpoint" is the pair (host, port). This allows a
  807.       given host to be running multiple concurrent sessions, each with a
  808.       unique endpoint.
  809.  
  810.       3.7 Windows Winsock Sockets
  811.  
  812.       There are really two classes of Winsock API calls: blocking and
  813.       non-blocking (asynchronous). Sockets were originally designed for the
  814.       UNIX operating system, and block until a requested operation
  815.       completes. This works well in a true multi-tasked operating system
  816.       like UNIX.
  817.  
  818.       When the Windows Winsock API was designed for Windows 3.X, several
  819.       additional asynchronous winsock commands were added in addition to
  820.       the traditional blocking commands.
  821.  
  822.       3.8 Synchronous Versus Asynchronous Programming
  823.  
  824.       There are two different styles of Winsock programming: Synchonous and
  825.       Asychronous. Each has its advantages and disadvantages. WIL4C
  826.       supports both styles of programming.
  827.  
  828.       Examples of the synchronous style include HOST, SFINGR, VIEW, WHO_S,
  829.       and WHO_C.
  830.  
  831.       Example of the asynchronous style include AFINGR, FINGER, NNTP, MAIL,
  832.       and FROM.
  833.  
  834.       FTP is an example employing both synchronous and asynchronous styles.
  835.  
  836.  
  837.  
  838.  
  839.  
  840.      WIL4C Users Manual                                        Page 14
  841.  
  842.       3.8.1 Synchronous Programming
  843.  
  844.       The synchronous style of Winsock programming is characterized by
  845.       sending a command, then waiting for the response in a polling loop.
  846.       Typically, the hour glass cursor is displayed during this waiting
  847.       period. This style is typical of UNIX programs, but does not mesh
  848.       well with the Windows message event loop, except for perhaps program
  849.       threads running under Win32. On the positive side, synchronous
  850.       programs are easier to follow and require less code.
  851.  
  852.       3.8.2 Asynchronous Programming
  853.  
  854.       The asynchronous style of Winsock programming is characterized by
  855.       sending a command, then continuing on with other work until a message
  856.       arrives signifying the completion of the command request. This style
  857.       of Winsock programming uses the Windows message loop mechanism, and
  858.       is considered the "Windows friendly" approach.
  859.  
  860.       Compare the three Finger programs SFINGR, AFINGR, and FINGER. SFINGR
  861.       uses the synchronous style, AFINGR uses the asynchronous style, and
  862.       FINGER uses the asynchronous style as implemented with the ASYNC.C
  863.       module functions.
  864.  
  865.       Studying the three Finger programs (SFINGR, SFINGR, and FINGER) is a
  866.       good way to compare the synchronous versus the two asynchronous
  867.       styles of Winsock programming.
  868.  
  869.       Refer to the following section "The ASYNC Functions" for details on
  870.       how the ASYNC functions operate. In particular, compare AFINGR (which
  871.       does not use the ASYNC functions) to FINGER (which does).
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.      WIL4C Users Manual                                        Page 15
  901.  
  902.       3.9 The ASYNC Functions
  903.  
  904.       The ASYNC functions operate using the wilAwaitEvent function to post
  905.       winsock event messages to WM_USER, which are passed to the ASYNC code
  906.       for processing. Messages may also be posted to WM_USER+1 to notify
  907.       the application of the completion of a sequence of requested events.
  908.       In practice, this is simpler than it sounds. Examine FINGER.C to see
  909.       an example.
  910.  
  911.       The ASYNC functions are contained in the file ASYNC.C.
  912.  
  913.       3.9.1 AsyncConnect
  914.  
  915.       The purpose of the AsyncConnect function is to connect to a remote
  916.       host.
  917.  
  918.       SOCKET AsyncConnect(
  919.                    HWND hWnd,   /* window to post messages */
  920.              LPSTR ServerType,  /* server type (eg: POP3) */
  921.              LPSTR ServerName,  /* server name (eg: mail.iquest.com) */
  922.                      int Port,  /* sever port */
  923.                int SuccessMsg,  /* wParam for WM_MSG if successful */
  924.                int FailureMsg)  /* wParam for WM_MSG if failure */
  925.  
  926.       In the following call to AsyncConnect, the caller is requesting a
  927.       connection to a POP3 server with name "mail.iquest.com", using the
  928.       well known POP3 port 110. If the connection is successful, message
  929.       SUCCESS_MSG should be posted for event WM_USER+1 in window hWnd.
  930.       If unsuccessful, FAILURE_MSG should be posted for event WM_USER+1.
  931.  
  932.       Socket = AsyncConnect(hMainWnd, "POP3", "mail.iquest.com",
  933.                             110, SUCCESS_MSG, FAILURE_MSG);
  934.  
  935.       Upon success, the returned socket may be used for socket I/O.
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.      WIL4C Users Manual                                        Page 16
  961.  
  962.       3.9.2 AsyncRead
  963.  
  964.       The purpose of the AsyncRead function is to wait for any incoming
  965.       data on the port specified in the call to AsyncConnect.
  966.  
  967.       int AsyncRead(
  968.                int SuccessMsg,  /* wParam for WM_MSG if successful */
  969.                int FailureMsg,  /* wParam for WM_MSG if failure */
  970.                int ReadType)    /* async read type */
  971.  
  972.       The ReadType can be any of the following:
  973.  
  974.          ReadType Symbol      Response Expected
  975.          ASYNC_NONE             No server response is expected.
  976.          ASYNC_SINGLE_LINE      Single Line of Text (LOT).
  977.          ASYNC_MULTIPLE_LINES   Multiple LOTs.
  978.          ASYNC_SINGLE_CODED     Single line: decimal response plus LOT.
  979.          ASYNC_MULTIPLE_CODED   Multiple lines: decimal response plus LOT.
  980.          ASYNC_PLUS_MINUS       Single line: "+OK" or "-ERR" plus LOT.
  981.  
  982.       The "Line of Text" (LOT) above consists of 7-bit ASCII characters
  983.       followed by a carriage return (CR) and line feed (LF). The "decimal
  984.       response" code consists of 3 decimal ASCII digits (eg: "125").
  985.  
  986.       In the following call to AsyncRead, the caller is awaiting a single
  987.       line of test. Once the incoming text line is read and optionally
  988.       echoed to the display (see AsyncSetEcho), message SUCCESS_MSG
  989.       should be posted for event WM_USER+1. If unsuccessful, FAILURE_MSG
  990.       should be posted for event WM_USER+1.
  991.  
  992.       AsyncRead = AsyncRead(SUCCESS_MSG, FAILURE_MSG, ASYNC_SINGLE_LINE);
  993.  
  994.       3.9.3 AsyncWrite
  995.  
  996.       The purpose of the AsyncWrite command is to write the specified
  997.       command on the port specified in the call to AsyncConnect.
  998.  
  999.       int AsyncWrite(
  1000.                 LPSTR Command,  /* command to send to server */
  1001.                int SuccessMsg,  /* wParam for WM_MSG if successful */
  1002.                int FailureMsg)  /* wParam for WM_MSG if failure */
  1003.  
  1004.       In the following call to AsyncWrite, the caller wants to write the
  1005.       text line in 'Command'. Once the text line is written and optionally
  1006.       echoed to the display (see AsyncSetEcho), message SUCCESS_MSG should
  1007.       be posted for event WM_USER+1. If unsuccessful, FAILURE_MSG should be
  1008.       posted for event WM_USER+1.
  1009.  
  1010.       AsyncRead = AsyncWrite("LIST", SUCCESS_MSG, FAILURE_MSG);
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.      WIL4C Users Manual                                        Page 17
  1021.  
  1022.       3.9.4 AsyncCommand
  1023.  
  1024.       The purpose of the AsyncCommand command is to combine the functions of
  1025.       AsyncWrite and AsyncRead into a single command.
  1026.  
  1027.       See AsyncWrite and AsyncRead above. Also refer to ther example
  1028.       programs which use AsyncCommand.
  1029.  
  1030.       int AsyncCommand(
  1031.                 LPSTR Command,  /* command to send to server */
  1032.                int SuccessMsg,  /* wParam for WM_MSG if successful */
  1033.                int FailureMsg,  /* wParam for WM_MSG if failure    */
  1034.                int ReadType)    /* async read type */
  1035.  
  1036.       3.9.5 AsyncGetBufPtr
  1037.  
  1038.       The purpose of the AsyncGetBufPtr is to return a pointer to the text
  1039.       line buffer used by AsyncRead, AsyncWrite, and AsyncCommand.
  1040.  
  1041.       LPSTR AsyncGetBufPtr(void);
  1042.  
  1043.       3.9.6 AsyncProcessMsg
  1044.  
  1045.       The purpose of the AsyncProcessMsg command is to process WM_USER
  1046.       messages. The main window (as specified by hWnd in the call to
  1047.       AsyncConnect) should contain the following line in the main event
  1048.       loop:
  1049.  
  1050.          case WM_USER:
  1051.            AsyncProcessMsg(wParam)
  1052.            break;
  1053.  
  1054.       The application should NOT post WM_USER messages when using the ASYNC
  1055.       functions.
  1056.  
  1057.       3.9.7 AsyncSetEcho
  1058.  
  1059.       The purpose of the AsyncSetEcho function is to set the echo flag for
  1060.       all subsequent ASYNC processing.
  1061.  
  1062.          int AsyncSetEcho(int EchoFlag);
  1063.  
  1064.       If the EchoFlag is TRUE, all text strings sent to (and received from)
  1065.       the server are echoed to the display. The AsyncSetEcho function
  1066.       returns the previous value of the echo flag.
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.      WIL4C Users Manual                                        Page 18
  1081.  
  1082.       3.9.8 AsyncSetDebug
  1083.  
  1084.       The purpose of the AsyncSetDebug function is to set the debug flag.
  1085.       The DebugFlag is used by the ASYNC code to display additional
  1086.       information. The AsyncSetDebug flag is meant for debugging ASYNC
  1087.       calls.
  1088.  
  1089.          int AsyncSetDebug(int DebugFlag);
  1090.  
  1091.       The programmer should rarely have need to use this function.
  1092.  
  1093.       3.9.9 POST Macros
  1094.  
  1095.       Posting to WM_USER is reserved for ASYNC functions. Posting to
  1096.       WM_USER+1 may be done by both ASYNC finctions and application
  1097.       functions.
  1098.  
  1099.       Two macros are defined for posting messages to WM_USER+1. The
  1100.       POST_MSG macro posts message (m) with parameter value 0. The
  1101.       POST_PARM macro posts message (m) with parameter (p).
  1102.  
  1103.       The POST_PARM macro is used pass back the numeric 3-digit response
  1104.       codes from SMTP, FTP, etc., or the "+OK" (100) or "-ERR" (500) POP3
  1105.       codes.
  1106.  
  1107.       The macros are defined in ASYNC.H as
  1108.  
  1109.          #define POST_MSG(m) PostMessage(hMainWnd,WM_USER+1,(m),0)
  1110.  
  1111.          #define POST_PARM(m,p) PostMessage(hMainWnd,WM_USER+1,(m),(p))
  1112.  
  1113.       The POST macros are used by both the ASYNC functions and the example
  1114.       code.
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.      WIL4C Users Manual                                        Page 19
  1141.  
  1142.       4.0 Internet Protocols
  1143.  
  1144.       The Internet protocols to follow all communicate using ASCII text
  1145.       lines. Each line ends with a carriage return, line feed (CR, LF)
  1146.       pair. The client program initiates the protocol by connecting to the
  1147.       server. What happens next is dependent on the particular protocol.
  1148.  
  1149.       The following discussions are for overview only. Refer to the proper
  1150.       RFCs for details on the protocols.
  1151.  
  1152.       4.1 Finger
  1153.  
  1154.       The Finger protocol is one of the simplest Internet protocols. For
  1155.       this reason, it is an excellent protocol to study for those without
  1156.       any Winsock programming experience.
  1157.  
  1158.       Finger allows one to retrieve information about a remote user on a
  1159.       remote host machine. If the remote user has a "plan file", then this
  1160.       information is returned in addition to the normal Finger data.
  1161.  
  1162.       Finger uses TCP with well known port number 79.
  1163.  
  1164.       The client side of the Finger protocol works as follows:
  1165.  
  1166.       (1) The client connects to the Finger sever on the remote host using
  1167.       TCP and port 79. The server does NOT send a greeting.
  1168.  
  1169.       (2) Once connected, the client sends a single line of text containing
  1170.       the login name of the user for which information is wanted.
  1171.  
  1172.       (3) The Finger server will send a series of text lines back. After
  1173.       the last line, the Finger server closes the connection.
  1174.  
  1175.       The Finger protocol is a very simple protocol. Three example Finger
  1176.       programs are included:
  1177.  
  1178.       (1) SFINGR: Synchronous version of Finger.
  1179.       (2) AFINGR: Asynchronous version of Finger.
  1180.       (3) FINGER: Asynchronous version of Finger using the ASYNC functions.
  1181.  
  1182.       Also see RFC 1288 for a detailed description of Finger.
  1183.  
  1184.       Note that not all Internet hosts provide Finger servers, although
  1185.       many do.
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.      WIL4C Users Manual                                        Page 20
  1201.  
  1202.       4.2 SMTP
  1203.  
  1204.       The SMTP (Simple Mail Transport Protocol) protocol allows the user to
  1205.       send mail to a remote user. SMTP uses TCP with well known port number
  1206.       25. All mail messages must consist of one or more lines of 7-bit
  1207.       ASCII characters, each line terminating with a carriage return, line
  1208.       feed pair.
  1209.  
  1210.       All server responses begin with a 3 digit decimal response code.
  1211.       Values of 500 and above indicate an error condition.
  1212.  
  1213.       4.2.1 SMTP Protocol
  1214.  
  1215.       The client side of the SMTP protocol works as follows:
  1216.  
  1217.       (1) The client connects to the SMTP server on the remote host using
  1218.       well known port 25. Once connected, the server responds with a
  1219.       greeting message, which may be one or more lines.
  1220.  
  1221.       (2) The client sends the "HELO myhost.com" command to the server
  1222.       where myhost.com is the local host name. The server responds with a
  1223.       greeting message.
  1224.  
  1225.       (3) The client sends the "MAIL FROM" command as shown in the example
  1226.       below. The server should respond with "250 OK".
  1227.  
  1228.       (4) The client sends the "RCPT TO" command to identify the recipient
  1229.       of the mail. The server responds with "250 OK". Additional recipients
  1230.       are sent by the client as required by sending additional "RCPT TO"
  1231.       commands.
  1232.  
  1233.       (5) The client sends the "DATA" command as shown below. The server
  1234.       responds with "250 OK".
  1235.  
  1236.       (6) The client sends the mail message as a series of text lines, each
  1237.       terminated by a carriage return, line feed pair. A text line
  1238.       consisting of just a period is "quoted" by adding a second period,
  1239.       since a line with a lone period indicates the end of the message.
  1240.  
  1241.       After all message lines have been sent, a line with a lone period
  1242.       (".\r\n") is sent to end the transmission. The server responds with
  1243.       "250 OK".
  1244.  
  1245.       (7) If another email is to be send, go back to step (4) above,
  1246.       otherwise sign off by sending the "QUIT" command.
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.      WIL4C Users Manual                                        Page 21
  1261.  
  1262.       4.2.2 SMTP Example
  1263.  
  1264.       In the following example, the caller mike@marshallsoft.com sends a 3
  1265.       line email message to Pierre at pierre@louve.com. Each line sent and
  1266.       received terminates with a carriage return, line feed pair. The "C:"
  1267.       (for client) and "S:" (for server) are not part of the protocol, but
  1268.       are shown to identify the client (C:) and server (S:) originated
  1269.       messages.
  1270.  
  1271.       C: (Connects to remote SMTP server).
  1272.       S: 220 LOUVE.COM SMTP server version 1.2.1
  1273.       C: HELO marshallsoft.com
  1274.       S: 250 Nice to meet you marshallsoft.com
  1275.       C: MAIL FROM:<mike@marshallsoft.com>
  1276.       S: 250 OK
  1277.       C: RCPT TO:<pierre@louve.com>
  1278.       S: 250 OK
  1279.       C: DATA
  1280.       S: 250 OK
  1281.       C: first line of email
  1282.       C: second line of email
  1283.       C: third line of email
  1284.       C: .
  1285.       S: 250 OK
  1286.       C: QUIT
  1287.       S: 221 au revoir.
  1288.  
  1289.       Refer to the MAIL and BCAST programs for examples of a SMTP client.
  1290.  
  1291.       Also see RFC 821 for a complete description of SMTP.
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.      WIL4C Users Manual                                        Page 22
  1321.  
  1322.       4.3 POP3
  1323.  
  1324.       The POP3 (Post Office Protocol version 3) protocol allows the user to
  1325.       retrieve mail from his POP3 server. POP3 uses TCP with well known port
  1326.       number 110.
  1327.  
  1328.       All server responses consists of a single line of text ending with a
  1329.       carriage return, line feed pair and beginning with either a "+OK" or
  1330.       "-ERR".
  1331.  
  1332.       4.3.1 POP3 Protocol
  1333.  
  1334.       The client side of the POP3 protocol works as follows:
  1335.  
  1336.       (1) The client connects to the POP3 sever on the remote host using
  1337.       TCP and port 110.  The server responds with its greeting.
  1338.  
  1339.       (2) The client sends the USER command to identify the account. The
  1340.       server responds with "+OK".
  1341.  
  1342.       (3) The client sends the password for the USER account using the PASS
  1343.       command. The server responds with a "+OK".
  1344.  
  1345.       (4) The client is now "logged onto" the POP3 server. Several commands
  1346.       can now be sent including:
  1347.  
  1348.         (a) The STAT command request the # of messages (and total bytes)
  1349.             waiting.
  1350.  
  1351.         (b) The RETR command retrieves a particular message number.
  1352.  
  1353.         (c) The DELE command deletes a particular message number
  1354.  
  1355.       Refer to the following example for the usage of these commands.
  1356.  
  1357.       (5) After all processing is done, the QUIT command is sent to log off
  1358.       of the POP3 server. The server responds with "+OK".
  1359.  
  1360.       Note that you must have a POP3 account set up by the host computer's
  1361.       system administrator. Mail sent to you is queued on your POP3 account
  1362.       for retrieval by you.
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.      WIL4C Users Manual                                        Page 23
  1381.  
  1382.       4.3.2 POP3 Example
  1383.  
  1384.       In the following example, Pierre has a POP3 account set up with user
  1385.       name "Pierre" and password "francaise". The client program connects
  1386.       to the POP3 server, gets the message status, receives the first
  1387.       message, and then deletes it.
  1388.  
  1389.       C: (Connects to remote POP3 server).
  1390.       S: +OK server SuperPOP ready.
  1391.       C: USER Pierre
  1392.       S: +OK user is Pierre
  1393.       C: PASS francaise
  1394.       S: +OK Pierre's maildrop has 2 messages.
  1395.       C: STAT
  1396.       S: +OK 2 1950
  1397.       C: RETR 1
  1398.       S: +OK 1050 bytes
  1399.       S: (1st line of email message 1)
  1400.       S: (2nd line of email message 1)
  1401.       :
  1402.       S: (last line of email message 1)
  1403.       S: .
  1404.       C: DELE 1
  1405.       S: +OK message 1 deleted
  1406.       C: QUIT
  1407.       S: +OK goodbye.
  1408.  
  1409.       Refer to the FROM and MAIL programs for examples of a POP3 client.
  1410.  
  1411.       Also see RFC 1460 for a complete description of SMTP.
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.      WIL4C Users Manual                                        Page 24
  1441.  
  1442.       4.4 NNTP
  1443.  
  1444.       The NNTP (Network News Transport Protocol) protocol allows the
  1445.       client to download (and upload) network news articles from his NNTP
  1446.       server. NNTP uses TCP with well known port number 119.
  1447.  
  1448.       The client sends text command lines to the server, and the server
  1449.       responds with a 3 digit numeric coded response line plus the
  1450.       requested text information. If text information is sent by the
  1451.       server, the last line will consist of (a text line with) a single
  1452.       period. Server response codes of 500 and above indicate an error
  1453.       condition.
  1454.  
  1455.       The NTTP news server maintains a list of news articles grouped into
  1456.       sets called "newsgroups", each of which has a name. The LIST command
  1457.       can be used to read all newsgroups. A particular newgroup must be
  1458.       selected by the GROUP command before any news articles can be read.
  1459.  
  1460.       Each newsgroup consists of zero or more articles. Individual articles
  1461.       are numbered and are deleted by the server after some period of time
  1462.       after first receiving the article, depending on the individual
  1463.       server. The article number of deleted articles are not reused.
  1464.  
  1465.       Each article consists of two parts: the article header and the
  1466.       article body. The article header consists of a short summary of the
  1467.       article body itself. The server maintains a "current pointer" to the
  1468.       current article, initialized to the first article in the newsgroup.
  1469.  
  1470.       Once a newsgroup has been selected, news headers and/or articles can
  1471.       be read. Commands include:
  1472.  
  1473.          HEAD        : read the current article header.
  1474.          HEAD ddd    : read article header number ddd (eg: READ 1286).
  1475.          ARTICLE     : read the current article.
  1476.          ARTICLE ddd : read article number ddd.
  1477.          NEXT        : advance to next article in the newsgroup.
  1478.          LAST        : advance to last article in the newsgroup.
  1479.  
  1480.       Articles can also be posted by the NTTP client by using the POST
  1481.       command, if allowed for the particular newsgroup.
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.      WIL4C Users Manual                                        Page 25
  1501.  
  1502.       4.4.1 NNTP Protocol
  1503.  
  1504.       The client side of the NNTP protocol works as follows:
  1505.  
  1506.       (1) The client connects to the NNTP sever on the host (typically your
  1507.       ISP) using TCP and port 119. The server responds with its greeting
  1508.       message.
  1509.  
  1510.       (2) The client may send a LIST command to request a list of
  1511.       newsgroups. The server responds with a (usually very long) list of
  1512.       newsgroups.
  1513.  
  1514.       (3) The client selects a newsgroup using the GROUP command. The
  1515.       server responds with a response line consisting of the response code,
  1516.       the number of articles, the first article number, the last article
  1517.       number, and the group selected. For example
  1518.  
  1519.          211 1982 18726 21918 comp.lang.c
  1520.  
  1521.       (4) The client requests article headers by using the HEADER command
  1522.       and the article body itself by using the ARTICLE command. The client
  1523.       may also advance the current article pointer by using the NEXT or
  1524.       LAST command. Note that the NEXT and LAST command do not retrieve a
  1525.       article header or the article body itself, but rather just move the
  1526.       current article pointer so that subsequent HEADER or ARTICLE commands
  1527.       (without a specified article number argument) will retrieve the
  1528.       current article header or article body.
  1529.  
  1530.       (5) The client can post articles, if allowed, by using the POST
  1531.       command. After sending the POST command (without any arguments), the
  1532.       server will prompt you to send the body of the article to be posted,
  1533.       which consists of multiple text lines, followed by a line with just a
  1534.       period.
  1535.  
  1536.       Refer to RFC 1036 for details on article formats.
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.      WIL4C Users Manual                                        Page 26
  1561.  
  1562.       4.4.2 NNTP Example
  1563.  
  1564.       In the following NNTP session, the client connects to the NTTP
  1565.       server, request a list of all newsgroups, selects newsgroup
  1566.       comp.lang.c, request the current (first) article, request the last
  1567.       article, then quits.
  1568.  
  1569.       C: (Connects to NTTP server using TCP on port 119).
  1570.       S: SuperNTTP ready. Posting OK.
  1571.       C: LIST
  1572.       S: comp.protocols.tcp-ip 514 819 Y
  1573.       S: comp.lang.c 1182 1271
  1574.       :
  1575.       S: .
  1576.       C: GROUP comp.lang.c
  1577.       S: 211 1982 18726 21918 comp.lang.c
  1578.       C: ARTICLE
  1579.       S: 1st line of current article (#18726)
  1580.       S: 2nd line of current article (#18726)
  1581.       :
  1582.       S: last line of current article (#18726)
  1583.       S: .
  1584.       C: LAST
  1585.       S: Article 21918 selected. Use ARTICLE to retrieve article.
  1586.       C: ARTICLE
  1587.       S: 1st line of current article (#21918)
  1588.       S: 2nd line of current article (#21918)
  1589.       :
  1590.       S: last line of current article (#21918)
  1591.       S: .
  1592.       C: QUIT
  1593.  
  1594.       Refer to the NEWS program for an example of a NNTP client. Note that
  1595.       the example program NEWS does not support article posting.
  1596.  
  1597.       Refer to RFC 1036 for a complete description of NNTP.
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.      WIL4C Users Manual                                        Page 27
  1621.  
  1622.       4.5 FTP
  1623.  
  1624.       The FTP (File Transfer Protocol) protocol allows the user to upload
  1625.       and download text and binary files. FTP uses TCP with well known port
  1626.       number 21.
  1627.  
  1628.       Two types of FTP service exists. The first is where the client
  1629.       connects to a remote host for which he knows the password, allowing
  1630.       him both read and write access.
  1631.  
  1632.       The second type of FTP service is called "anonymous FTP" in which the
  1633.       USER name is "anonymous" ("ftp" is sometimers acceptable instead of
  1634.       "anonymous") with the password set to the clients' email address.
  1635.       This type of FTP service is very common on the Internet. Examples
  1636.       include the MarshallSoft Computing anonymous FTP site at
  1637.       "ftp.marshallsoft.com".
  1638.  
  1639.       The FTP server responds to client commands with a 3 digit number
  1640.       response code followed by the text of the repsonse message, and
  1641.       ending with a carriage return, line feed pair. Response codes of 500
  1642.       and above indicate a fatal error condition, 400 to 499 indicate a
  1643.       recoverable error condition (try the command again), while codes of
  1644.       100 through 399 indicate that all went OK. Refer to RFC 959 for more
  1645.       details on FTP response codes.
  1646.  
  1647.       The FTP server may respond with a multi-line response. A dash after
  1648.       the response code indicates that this is not the last response line.
  1649.  
  1650.          100-1st line of response.
  1651.          100-2nd line of response.
  1652.          100 last line of response.
  1653.  
  1654.       Occassionally, other response codes are sent before the last response
  1655.       line, which must always have the same response code as the first
  1656.       response line. For example,
  1657.  
  1658.          100-1st line of response for code 100.
  1659.          101 1st line ine of response for code 101.
  1660.          100 last line of response.
  1661.  
  1662.       FTP does not use the port on which it connects (the control port) to
  1663.       transfer data. Rather, the FTP specifies (using the control port)
  1664.       which port to establish a data connection on using the PORT command
  1665.       (see below). The FTP client then listens on this port for a
  1666.       connection, after which data can be transferred. After all data is
  1667.       transferred, the data port is closed.
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.      WIL4C Users Manual                                        Page 28
  1681.  
  1682.       4.5.1 FTP Protocol
  1683.  
  1684.       The FTP protocol works as follows:
  1685.  
  1686.       (1) The client connects to the FTP sever on the remote host using TCP
  1687.       and port 21. The server responds with its greeting.
  1688.  
  1689.       (2) The client sends the USER command to identify the account. The
  1690.       server responds with response code 331.
  1691.  
  1692.       (3) The client sends the password for the USER account using the PASS
  1693.       command. The server responds with response code 230.
  1694.  
  1695.       (4) The client is now "logged onto" the FTP server. Several commands
  1696.       can now be sent including:
  1697.  
  1698.         (a) The CWD command changes the working directory on the remote
  1699.             machine. If you connect to ftp.marshallsoft.com, you should
  1700.             use the CWD command to change the working directory to
  1701.             "marshallsoft".
  1702.  
  1703.         (b) The LIST command lists all the files in the directory on the
  1704.             remote computer. The LIST command does a formatted list, while
  1705.             the NLST command just lists the filenames. The LIST (and NLST)
  1706.             command requires that the PORT command (see below) be issued
  1707.             first to establish the data port.
  1708.  
  1709.        (c)  The TYPE command is used to set either ASCII (TYPE A) or binary
  1710.             mode (TYPE I) to be used for subsequent file transfers. The
  1711.             default is ASCII. The ASCII and BINARY menu commands in the
  1712.             example program FTP.C issue the FTP TYPE command.
  1713.  
  1714.             The TYPE command should be used to set binary mode (see the
  1715.             example program FTP.C) before transfering binary files.
  1716.  
  1717.        (f)  The PORT command is used to specify the port over which data
  1718.             will be transferred. The PORT command must be used before using
  1719.             the LIST, NLST, RETR or STOR command. For example, to specify
  1720.             data port 6146 (256*24 + 2) using our (not the remote
  1721.             machines) IP address of 165.113.131.70, we use
  1722.  
  1723.                 PORT 165,113,131,70,24,2
  1724.  
  1725.         (e) The RETR command is used to download a file from the remote
  1726.             computer, using the type as set by the TYPE command, and the
  1727.             data port specified by the PORT command. The data port is
  1728.             closed immediately after all data is tranferred.
  1729.  
  1730.         (f) The STOR command is used to upload a file to the remote
  1731.             computer, using the type as set by the TYPE command, and the
  1732.             data port specified by the PORT command. The data port is
  1733.             closed immediately after all data is tranferred.
  1734.  
  1735.             Note that most anonymous FTP sites do not allow uploading.
  1736.  
  1737.         (g) The QUIT command logs off of the FTP server.
  1738.  
  1739.  
  1740.      WIL4C Users Manual                                        Page 29
  1741.  
  1742.       4.5.2 FTP Example
  1743.  
  1744.       In the following FTP session, Pierre connects to a FTP server as
  1745.       anonymous, lists all files, changes current directory to
  1746.       "marshallsoft/other", sets binary file type, downloads file
  1747.       DISKBK11.ZIP, then logs off.
  1748.  
  1749.       C: (Connects to remote FTP server).
  1750.       S: 220 SuperFTP server is ready.
  1751.       C: USER anonymous
  1752.       S: 331 Use email address for password.
  1753.       C: PASS pierre@louve.com
  1754.       S: 230-User Pierre logged on.
  1755.       S: 230 This site allows read access only!
  1756.       C: LIST
  1757.       S: (1st line of directory listing)
  1758.       S: (2nd line of directory listing)
  1759.       :
  1760.       S: (last line of directory listing)
  1761.       S: .
  1762.       C: CWD marshallsoft/other
  1763.       S: 250 CWD command successful.
  1764.       C: TYPE I
  1765.       S: 200 Type is set to I.
  1766.       C: PORT 11,231,11,14,20,15
  1767.       S: 200 Port command successful.
  1768.       C: GET diskbk11.zip
  1769.       S: 150 Opening BINARY mode data connection for diskbk11.zip
  1770.          (file comes in on data port, after which is is closed).
  1771.       S: 226 Transfer complete.
  1772.       C: QUIT
  1773.       S: Au revoir Pierre!
  1774.  
  1775.       Refer to the FTP program for an example of a FTP client.
  1776.  
  1777.       Refer to RFC 959 for a complete description of FTP.
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.      WIL4C Users Manual                                        Page 30
  1801.  
  1802.       4.6 HTTP
  1803.  
  1804.       The HTTP (Hyper Text Transfer Protocol) protocol defines the
  1805.       interation between World-Wide-Web (WWW) servers and WWW clients,
  1806.       popularly known as "Web Browsers".
  1807.  
  1808.       HTTP uses TCP with well known port number 80, and is documented in
  1809.       RFC 2068.
  1810.  
  1811.       HTTP is a complicated protocol. RFC 2068 describing HTTP/1.1 is 162
  1812.       pages in length. If you want to develop a web browser, you must get a
  1813.       copy of RFC 2068 from the Internic.
  1814.  
  1815.       You will also need to have a knowledge of HTML (Hypertext Markup
  1816.       Language) in order to interprete the data sent by the HTTP server.
  1817.       Fortunately, there are several very good books on HTML such as "Teach
  1818.       Yourself Web Publishing with HTML in 14 Days" by Laura LeMay (Sams
  1819.       Net).
  1820.  
  1821.       A very good way to get comfortable with HTML is to build your own WEB
  1822.       site. Most ISPs (Intenet Service Providers) make provisions for their
  1823.       customers to build "personal" web sites.
  1824.  
  1825.       With some practical experience "surfing the web", a knowledge of
  1826.       HTML, RFC2068, and the example program VIEW.C, you are ready to write
  1827.       a HTTP application.
  1828.  
  1829.       4.6.1 HTTP Protocol
  1830.  
  1831.       HTTP commands are termed "Methods". These commands are case-sensitive
  1832.       and include only two required (for all HTTP servers) commands: GET
  1833.       and HEAD.
  1834.  
  1835.       The GET command is the fundamental command which retrieves HTML
  1836.       pages. For example,
  1837.  
  1838.          GET /index.html HTTP/1.0
  1839.  
  1840.       requests page INDEX.HTML.
  1841.  
  1842.       The HEAD method is identical to GET except that only "meta"
  1843.       information is returned for the page.
  1844.  
  1845.       The HTTP client connects to the HTTP server on the remote host, sends
  1846.       a command, receives a response, then terminates the connection. This
  1847.       is repeated for each HTTP command.
  1848.  
  1849.       The server response consists of header text, followed by a blank
  1850.       line, followed by the actual HTML page requested. The first line of
  1851.       the header text consists of the status return, such as:
  1852.  
  1853.          HTTP/1.0 200 OK
  1854.  
  1855.       Return value of 500 & above are server errors, and 400 to 499 are
  1856.       client errors.
  1857.  
  1858.  
  1859.  
  1860.      WIL4C Users Manual                                        Page 31
  1861.  
  1862.       4.6.2 HTTP Example
  1863.  
  1864.       Suppose that the following Web page HELLO.HTM is on the MarshallSoft
  1865.       Web site (www.marshallsoft.com).
  1866.  
  1867.          <HTML> <HEAD>
  1868.          <TITLE> MarshallSoft Computing, Inc. </TITLE>
  1869.          </HEAD>
  1870.          <H1> Hello </H1>
  1871.          Hello, world!
  1872.          </BODY> </HTML>
  1873.  
  1874.       The following exchange with the HTTP server on the host requests the
  1875.       page HELLO.HTM.
  1876.  
  1877.       C: (Connects to remote FTP server).
  1878.       C: GET /index.html HTTP/1.0
  1879.       S: HTTP/1.0 200 OK
  1880.       S: Date: Wed, 09 Jul 1997 20:43:59 GMT
  1881.       S: Server: Apache/1.1.3
  1882.       S: Content-type: text/html
  1883.       S: Content-length: 183
  1884.       S: Last modified: Wed, 09 Jul 1997 20:00:01 GMT
  1885.       S:
  1886.       S: <HTML> <HEAD>
  1887.       S: <TITLE> MarshallSoft Computing, Inc. </TITLE>
  1888.       S: </HEAD>
  1889.       S: <H1> Hello </H1>
  1890.       S: Hello, world!
  1891.       S: </BODY> </HTML>
  1892.       C: (Disconnects)
  1893.  
  1894.       It is up to the HTTP client to interpret the HTML lines, for which
  1895.       knowledege of the HTML specification is necessary.
  1896.  
  1897.       Note that the client disconnects after receiving each page.
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.      WIL4C Users Manual                                        Page 32
  1921.  
  1922.       5.0 Problems
  1923.  
  1924.       Before attempting to run any of the example programs, you should
  1925.       already be able to connect to the Internet and run your email client
  1926.       program, such as Eudora or Pegasus Mail. You should also be
  1927.       comfortable as a user of the Internet before attempting to program
  1928.       Internet applications.
  1929.  
  1930.       If you cannot get your application to run properly, first compile and
  1931.       run the example programs. If you call us to report a possible bug in
  1932.       the library, the first thing we will ask is if the example programs
  1933.       run correctly.
  1934.  
  1935.       If you are having trouble with a particular protocol, download the
  1936.       RFCs from the Internic for detailed protocol information. Also
  1937.       experiment with the appropriate example program. Unfortunately, there
  1938.       is no substitute for trail and error! Another good resource are the
  1939.       many books and magazines articles around dealing with the various
  1940.       Internet protocols.
  1941.  
  1942.       Although we will be happy to talk to you, we are not experts on the
  1943.       Internet protocols. Our support is limited to the use of our library,
  1944.       not the operation of the Internet protocols.
  1945.  
  1946.       If your application does not run but the example applications run
  1947.       correctly, then you have most likely made a programming mistake in
  1948.       your application. MarshallSoft Computing cannot debug your
  1949.       application, especially over the telephone!
  1950.  
  1951.       We recommend the following steps if you believe that you have
  1952.       discovered a bug in the library: (1) Create the smallest, simplest
  1953.       test program possible that demonstrates the problem.  (2) Document
  1954.       your exact machine configuration and what error the test program
  1955.       demonstrates. (3) Email your program to us at bugs@marshallsoft.com.
  1956.  
  1957.       If the problem can be solved with an easy work-around, we will
  1958.       publish the work-around.  If the problem requires a modification to
  1959.       the library, we will make the change and make the modified library
  1960.       available to our customers without charge.
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.      WIL4C Users Manual                                        Page 33
  1981.  
  1982.       6.0 Example Programs
  1983.  
  1984.       There are 12 example programs, covering DNS, Finger, SMTP, POP3,
  1985.       NNTP, FTP, and HTTP.
  1986.  
  1987.       6.1 HOST
  1988.  
  1989.       The HOST program uses the Domain Name System (DNS) to get internet
  1990.       addresses for hosts for which their name is known. HOST can also get
  1991.       port and server information, if available.
  1992.  
  1993.       6.2 SFINGR, AFINGR, and FINGER
  1994.  
  1995.       The three finger programs demonstrate the 3 methods of using the
  1996.       WIL4C library. The FINGER protocol is presented in the section on
  1997.       protocols.
  1998.  
  1999.       SFINGR make only synchronous function calls. Refer to the section on
  2000.       "Synchronous WIL" for information on synchronous calls.
  2001.  
  2002.       AFINGR make asynchronous function calls. Refer to the section on
  2003.       "Asynchronous WIL" for information on aynchronous calls.
  2004.  
  2005.       FINGER make asynchronous function calls using the ASYNC commands.
  2006.       Refer to "Using ASYNC Functions" for more information.
  2007.  
  2008.       The Finger client program contact your Finger Server and requests
  2009.       information for a particular user. Many hosts do not have finger
  2010.       servers.
  2011.  
  2012.       You can finger MarshallSoft Computing by specifying (at the prompt)
  2013.       "msc@advicom.com".
  2014.  
  2015.       6.3 FROM
  2016.  
  2017.       The FROM client program logs onto your POP3 account and checks if
  2018.       you having any waiting mail. If you do, it list the messages by
  2019.       number along with the "From:" and "Subject:" fields, if any.
  2020.  
  2021.       In order to use FROM, you must edit the file FROM.INI which contains
  2022.       POP3 server addresses, and login name & password.
  2023.  
  2024.       For example, suppose your ISP (Internet Service Provider) has host
  2025.       address SUPERSERVE.COM, and your login name is billy. Then FROM.INI
  2026.       may contain:
  2027.  
  2028.          +---------------------------+
  2029.          | POP3=mail.superserve.com  |
  2030.          | USER=billy                |
  2031.          | PASS=my_password          |
  2032.          +---------------------------+
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.      WIL4C Users Manual                                        Page 34
  2041.  
  2042.       6.4 MAIL
  2043.  
  2044.       The mail client program is similiar to FROM, except that it can also
  2045.       send, receive, and delete mail.
  2046.  
  2047.       In order to use MAIL, you must edit the file MAIL.INI which contains
  2048.       SMTP & POP3 server addresses, and login name & password.
  2049.  
  2050.          +---------------------------+
  2051.          | SMTP=mail.superserve.com  |
  2052.          | POP3=mail.superserve.com  |
  2053.          | USER=billy                |
  2054.          | FROM=billy@superserve.com |
  2055.          | PASS=my_password          |
  2056.          +---------------------------+
  2057.  
  2058.       MAIL.INI is similiar to FROM.INI with the addition of the SMTP server
  2059.       (for sending mail) and your email address (FROM line). In fact, you
  2060.       can also use MAIL.INI for FROM.INI.
  2061.  
  2062.       See section 6.9 (BCAST) for a description of the file format for
  2063.       outgoing email messages. Note that the first line must be the
  2064.       destination email address.
  2065.  
  2066.       6.5 FTP
  2067.  
  2068.       The FTP (File Transfer Protocol) client program communicats with a
  2069.       FTP server, allowing for the transfer of ASCII and binary files.
  2070.       Refer to the section on protocols for information on the FTP
  2071.       protocol.
  2072.  
  2073.       You must provide the login name and password in FTP.INI. For example,
  2074.       if your email address is billy@superserve.com, FTP.INI would contain
  2075.       the following for anonymous FTP.
  2076.  
  2077.          +---------------------------+
  2078.          | USER=anonymous            |
  2079.          | PASS=billy@superserve.com |
  2080.          +---------------------------+
  2081.  
  2082.       The FTP client program is capable of the following operations:
  2083.  
  2084.       Command  Description
  2085.           CWD  Changes the working directory at the host.
  2086.          LIST  List the contents of the current working directory.
  2087.         ASCII  Set ASCII transfer mode.
  2088.        BINARY  Sets binary transfer mode.
  2089.           GET  Receives specified file from the host.
  2090.           PUT  Sends specified file to the host.
  2091.          QUIT  Quits the FTP session.
  2092.  
  2093.       Don't forget to set BINARY mode before downloading or uploading a
  2094.       binary file.
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.      WIL4C Users Manual                                        Page 35
  2101.  
  2102.       6.6 NEWS
  2103.  
  2104.       The NEWS client program communicates with a NNTP (Network News
  2105.       Transport Protocol) and provides the following functions:
  2106.  
  2107.       Command           Description
  2108.       Group/
  2109.         List            List all groups.
  2110.         Select          Select a group for subsequent processing.
  2111.       Header/
  2112.         GetByNumber     Selects header by number.
  2113.         GetCurrent      Selects current header.
  2114.         Next            Selects next header.
  2115.         Last            Select last header.
  2116.       Article/
  2117.         GetByNumber     Selects article by number.
  2118.         GetCurrent      Selects current article.
  2119.         Next            Selects next article.
  2120.         Last            Select last article.
  2121.       Quit              Quits the NEWS server.
  2122.  
  2123.       If the user specifies "Group/List", the incoming list of groups is
  2124.       saved in the file NEWS.LST. If the user requests an article by number
  2125.       "Article/GetByNumber", then the article is saved with file extension
  2126.       ".ART".
  2127.  
  2128.       Refer to the section "NNTP Protocol" for information on NNTP.
  2129.  
  2130.       6.7 VIEW
  2131.  
  2132.       VIEW is HTTP client program which requests and displays source code
  2133.       for a specified HTTP web page. VIEW is not a browser!
  2134.  
  2135.       VIEW can be used as the basis for several types of HTTP clients. Some
  2136.       ideas are as follows:
  2137.  
  2138.       (1) VIEW can be used as the starting point for a web browser. Most of
  2139.       the effort will be in writing the code necessary to interpret the
  2140.       HTML (Hypertext Markup Language) text.
  2141.  
  2142.       (2) VIEW could also be used as the basis for a "ROBOT" program, that
  2143.       searches for email addresses. This is what some search engines do in
  2144.       order to catalog the web sites on the Internet.
  2145.  
  2146.       (3) VIEW could also be used as the starting point for a program that
  2147.       connects to a search engine, copying search results for subsequent
  2148.       anyalyis.
  2149.  
  2150.       VIEW uses the synchronous style of programming.
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.      WIL4C Users Manual                                        Page 36
  2161.  
  2162.       6.8 WHO_C and WHO_S
  2163.  
  2164.       WHO_S is a server program which provides "WHOIS" service for three
  2165.       individuals as requested by the client WHOIS program WHO_C.
  2166.  
  2167.       After starting the server WHO_S, note the IP address. Next, start the
  2168.       client WHO_C, using the WHO_S server IP address to specify the server.
  2169.  
  2170.       Then, specify one of the three people in the WHOIS database: Mike,
  2171.       Pam, or Lauren.
  2172.  
  2173.       The purpose of the WHOIS programs is to demonstate how to write a
  2174.       simple Internet server and matching client.
  2175.  
  2176.       6.9 BCAST
  2177.  
  2178.       BCAST is a SMTP client that emails a file to each address specified
  2179.       in a list, such as emailing our newsletter to our customers.
  2180.  
  2181.       Several pieces of information must be in the BCAST.INI file:
  2182.  
  2183.       +-------------------------------+
  2184.       | SMTP=your_SMTP_server_address |
  2185.       | FROM=your_email_address       |
  2186.       | RCPT=file_of_email_addresses  |
  2187.       | MAIL=file_to_email            |
  2188.       +-------------------------------+
  2189.  
  2190.       Outgoing email messages should be ASCII text files formatted as:
  2191.  
  2192.       Line 1: Email address of destination (MAIL program only).
  2193.       Line 2: "To: " header line.
  2194.       Line 3: "From: " header line.
  2195.       Line 4: "Subject: " header line.
  2196.       Line 5: Blank line.
  2197.       Line 6 to last_line: ASCII email message.
  2198.  
  2199.       Example outgoing email message:
  2200.  
  2201.       +-----------------------------------------------------+
  2202.       |mike@marshallsoft.com                                |
  2203.       |To: mike@marshallsoft                                |
  2204.       |From: pam@traveller.com                              |
  2205.       |Subject: Test message                                |
  2206.       |                                                     |
  2207.       |The mail destination address must be the 1st line for|
  2208.       |email being sent with the MAIL example program. The  |
  2209.       |"To:", "From:", and "Subject:" fields are optional.  |
  2210.       |There should be a blank line before the body of the  |
  2211.       |message. [7/25/97].                                  |
  2212.       +-----------------------------------------------------+
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.      WIL4C Users Manual                                        Page 37
  2221.  
  2222.       7.0 Legal Issues
  2223.  
  2224.       7.1 Registration
  2225.  
  2226.  
  2227.       WIL4C may be registered for $95 plus $6 S&H ($12 outside of North
  2228.       America).
  2229.  
  2230.       To order, contact us as shown on the title page of this manual. All
  2231.       prices are guaranteed for one year from the release date.
  2232.  
  2233.       Multiple copy discounts (3 or more) and site licenses are available.
  2234.       Please call for details.
  2235.  
  2236.       We  accept American Express, VISA, MasterCard, Discover, checks in US
  2237.       dollars drawn on  a  US  bank,  International  Postal  Money  Orders,
  2238.       purchase orders (POs) from recognized US schools and companies listed
  2239.       in  Dun  &  Bradstreet,  and  COD  (street  address  and phone number
  2240.       required) within the USA (plus a $5 COD charge).
  2241.  
  2242.       For credit card orders, be sure to include the account number, the
  2243.       expiration date, the exact name on the card, and the complete card
  2244.       billing address (the address to which the credit card bill is
  2245.       mailed).
  2246.  
  2247.       Print the file INVOICE.TXT if a "Pro Forma" invoice is needed.
  2248.  
  2249.       If you wish to update from an older version of WIL4C, send $25 plus
  2250.       $6 S&H ($12 S&H outside of North America).
  2251.  
  2252.       The registered package includes:
  2253.  
  2254.            o  Win16 & Win32 WIL4C Libraries w/o shareware screens.
  2255.            o  Win16 & Win32 source code for WIL and ASYNC.
  2256.            o  Printed Users Manual & Reference Manual.
  2257.            o  Telephone and email support for one year.
  2258.  
  2259.       The registered user will receive the latest version of WIL4C shipped
  2260.       by US second day priority mail (packet airmail overseas).  A 3.5"
  2261.       HD diskette is provided.
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.      WIL4C Users Manual                                        Page 38
  2281.  
  2282.       7.2 License
  2283.  
  2284.       MarshallSoft Computing, Inc. grants the registered user of WIL4C the
  2285.       right to use one copy of the WIL4C library (in object form) on a
  2286.       single computer in the development of any software product (other
  2287.       more than one computer at the same time.  The source code for the
  2288.       library (WIL.C and ASYNC.C) is copyrighted by MarshallSoft Computing
  2289.       and may not be released in whole or in part. Products developed using
  2290.       WIL4C may be distributed without royalty.
  2291.  
  2292.       7.3 Warranty
  2293.  
  2294.       MARSHALLSOFT COMPUTING, INC.  DISCLAIMS ALL WARRANTIES RELATING TO
  2295.       THIS SOFTWARE, WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
  2296.       LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  2297.       A PARTICULAR PURPOSE, AND ALL SUCH WARRANTIES ARE EXPRESSLY AND
  2298.       SPECIFICALLY DISCLAIMED. NEITHER MARSHALLSOFT COMPUTING, INC.  NOR
  2299.       ANYONE ELSE WHO HAS BEEN INVOLVED IN THE CREATION, PRODUCTION, OR
  2300.       DELIVERY OF THIS SOFTWARE SHALL BE LIABLE FOR ANY INDIRECT,
  2301.       CONSEQUENTIAL, OR INCIDENTAL DAMAGES ARISING OUT OF THE USE OR
  2302.       INABILITY TO USE SUCH SOFTWARE EVEN IF MARSHALLSOFT COMPUTING, INC.
  2303.       HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR CLAIMS. IN NO
  2304.       EVENT SHALL MARSHALLSOFT COMPUTING, INC.'S LIABILITY FOR ANY SUCH
  2305.       DAMAGES EVER EXCEED THE PRICE PAID FOR THE LICENSE TO USE THE
  2306.       SOFTWARE, REGARDLESS OF THE FORM OF THE CLAIM. THE PERSON USING THE
  2307.       SOFTWARE BEARS ALL RISK AS TO THE QUALITY AND PERFORMANCE OF THE
  2308.       SOFTWARE.
  2309.  
  2310.       Some states do not allow the exclusion of the limit of liability for
  2311.       consequential or incidental damages, so the above limitation may not
  2312.       apply to you.
  2313.  
  2314.       This agreement shall be governed by the laws of the State of Alabama
  2315.       and shall inure to the benefit of MarshallSoft Computing, Inc.  and
  2316.       any successors, administrators, heirs and assigns.  Any action or
  2317.       proceeding brought by either party against the other arising out of
  2318.       or related to this agreement shall be brought only in a STATE or
  2319.       FEDERAL COURT of competent jurisdiction located in Madison County,
  2320.       Alabama. The parties hereby consent to in personam jurisdiction of
  2321.       said courts.
  2322.  
  2323.  
  2324.  
  2325.  
  2326.  
  2327.  
  2328.  
  2329.  
  2330.  
  2331.  
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.  
  2339.  
  2340.      WIL4C Users Manual                                        Page 39
  2341.  
  2342.       8.0 Summary
  2343.  
  2344.       8.1 Revision History
  2345.  
  2346.       Version 1.0: 28 July, 1997.
  2347.  
  2348.           o  The initial release of WIL4C.
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.       [reserved]
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.       8.2 WIL4C Function Summary
  2364.  
  2365.       Refer to the WIL4C Reference Manual (WIL4C_R.TXT) for detailed
  2366.       information on the communications and support functions.  A one line
  2367.       summary of each function follows on the next page.
  2368.  
  2369.       There are 54 functions in the WIL library.
  2370.  
  2371.       Also examine the usage of these functions in the example programs.
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.      WIL4C Users Manual                                        Page 40
  2401.  
  2402.       +-------------------------------------------------------------------+
  2403.       | wilAccept : Accepts incoming connection.                          |
  2404.       | wilAttach : Attaches (initializes) winsock.                       |
  2405.       | wilAskHostByAddr : Request host information from server.          |
  2406.       | wilAskHostByName : Request host information from server.          |
  2407.       | wilAskProtoByName : Request protocol information.                 |
  2408.       | wilAskProtoByNumber : Request protocol information.               |
  2409.       | wilAskServByName : Request server information.                    |
  2410.       | wilAskServByPort : Request server information.                    |
  2411.       | wilAwaitEvent : Set asynchronous event winsock mask.              |
  2412.       | wilBind : Bind socket to specified address & port nunber.         |
  2413.       | wilCancelBlocking : Cancels blocking call.                        |
  2414.       | wilCloseSocket : Close socket.                                    |
  2415.       | wilConnect : Initiate connection to remote port.                  |
  2416.       | wilDataIsReady : Is socket readable (data is ready).              |
  2417.       | wilDebug : Returns bebug value.                                   |
  2418.       | wilErrorText : Get text associated with error code.               |
  2419.       | wilGetDescription : Get winsock description text.                 |
  2420.       | wilGetHostAddr : Get host address.                                |
  2421.       | wilGetHostAlias : Get host name alias.                            |
  2422.       | wilGetHostDotted : Get host dotted address.                       |
  2423.       | wilGetHostName : Get host name.                                   |
  2424.       | wilGetMaxSockets : Get maximum number of sockets supported.       |
  2425.       | wilGetMaxUDPSize : Get maximum UDP packet size.                   |
  2426.       | wilGetMyHostAddr : Get local host address.                        |
  2427.       | wilGetMyHostDotted : Get local host (dotted) address.             |
  2428.       | wilGetMyHostName : Get local host name.                           |
  2429.       | wilGetProtoName : Get protocol name.                              |
  2430.       | wilGetProtoNumber : Get protocol number.                          |
  2431.       | wilGetServName : Get server name.                                 |
  2432.       | wilGetServPort : Get server port.                                 |
  2433.       | wilGetSystemInfo : Get winsock system information.                |
  2434.       | wilGetVendorInfo : Get winsock vendor information.                |
  2435.       | wilIsBlocking : Is winsock currently blocking ?                   |
  2436.       | wilIsConnected : Is socket connected to remote ?                  |
  2437.       | wilIsDotted : Is dotted string properly formed ?                  |
  2438.       | wilListen : Listen for incoming connection attempts.              |
  2439.       | wilLocalSockAddr : Get local sock address for connected socket.   |
  2440.       | wilLocalSockPort : Get local sock port number for connected sock. |
  2441.       | wilParseDecimal : Parse decimal response code.                    |
  2442.       | wilPeekSocket : Peek into socket.                                 |
  2443.       | wilReadLine : Read line terminated with linefeed.                 |
  2444.       | wilReadOOB : Read Out-Of-Bound data.                              |
  2445.       | wilReadSocket : Read from socket.                                 |
  2446.       | wilReadString : Read string from socket.                          |
  2447.       | wilRelease : Release (free) winsock.                              |
  2448.       | wilRemoteSockAddr : Get remote sock address for connected socket. |
  2449.       | wilRemoteSockPort : Get remote port number for connected socket.  |
  2450.       | wilSetOOB : Sets Out-Of_Bound data state.                         |
  2451.       | wilSocketStatus : Get socket read/write status.                   |
  2452.       | wilTcpSocket : Create TCP socket.                                 |
  2453.       | wilWriteOOB : Write Out-Of_Bounds data to socket.                 |
  2454.       | wilWriteSocket : Write buffer to socket.                          |
  2455.       | wilWriteString : Write string to socket.                          |
  2456.       | wilWriteLine : Write linefeed terminated line to socket.          |
  2457.       +-------------------------------------------------------------------+
  2458.  
  2459.  
  2460.      WIL4C Users Manual                                        Page 41
  2461.  
  2462.  
  2463.       9.0 Other MarshallSoft Computing Products
  2464.  
  2465.       Several shareware products are available from MarshallSoft Computing.
  2466.  
  2467.       9.1 The Windows Standard Communications Library for C/C++
  2468.  
  2469.       The Windows Standard Communications Library for C/C++ (WSC4C) is a
  2470.       Windows based asynchronous serial communications library designed for
  2471.       software developers programming in C/C++. WSC4C uses the Windows
  2472.       communications driver. Both 16-bit amd 32-bit DLLs are included along
  2473.       with 5 example programs.
  2474.  
  2475.       The Windows Standard Communications Library for C/C++ (WSC4C) is
  2476.       available for $75 plus $6 S&H ($12 S&H overseas).
  2477.  
  2478.       9.2 The Personal Communications Library for Windows (C/C++)
  2479.  
  2480.       The Personal Communications Library for Windows (PCL4W) is a Windows
  2481.       based [Win16] asynchronous communications library designed for
  2482.       software developers programming in C/C++.  Unlike WSC4C, PCL4W
  2483.       interfaces to the serial port hardware directly.  PCL4W also supports
  2484.       multiport boards such as those made by DigiBoard and BOCA.
  2485.  
  2486.       The Personal Communications Library for Windows (PCL4W) is available
  2487.       for $75 plus $6 S&H ($12 S&H overseas).
  2488.  
  2489.       9.3 The Personal Communications Library for C/C++ / DOS
  2490.  
  2491.       PCL4C is similar to PCL4W except that it is designed for DOS.
  2492.       Includes support for both 16-bit and 32-bit protected mode.
  2493.  
  2494.       9.4 Libraries for Other Languages
  2495.  
  2496.       We have communications libraries for C/C++, Turbo Pascal, Visual
  2497.       Basic, and PowerBASIC. Check our BBS or WEB site.
  2498.  
  2499.        PCL4C  : C/C++, DOS [include 16-bit & 32-bit protected mode].
  2500.        PCL4P  : Turbo Pascal, DOS [includes 16-bit protected mode].
  2501.        PCL4VB : Visual Basic, DOS.
  2502.        PCL4PB : Power Basic, DOS.
  2503.  
  2504.         PCL4W : C/C++, Windows 3.1 & Win 95, talks to hardware directly.
  2505.        PCLVBW : Visual Basic, Win 3.1 & Win 95, talks to hardware directly.
  2506.  
  2507.         WSC4C : C/C++, Win 3.1, Win 95, Win NT. Uses Windows API.
  2508.        WSC4VB : Visual Basic, Win 3.1, Win 95, Win NT. Uses Windows API.
  2509.         WSC4D : Borland DELPHI, Win 3.1, Win 95, Win NT. Uses Windows API.
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.  
  2519.  
  2520.      WIL4C Users Manual                                        Page 42
  2521.  
  2522.  
  2523.